This file is more readable if maximized.

VBperm.exe is a Self-Extracting File which contains the Visual Basic Forms, Code Modules, et
cetera for a Permutation Generator Application. Included are 3 readme files: txt (almost any text
editor), .wpd (Corel WordPerfect), & .rtf (MicroSoft Word and/or WordPad, I think). The .wpd
& .rtf files have bold and color coding to make them more readable.

There is a .wpd file & a .rtf file containing this same information. I think MicroSoft Word &
WordPad can read .rtf files, but I am not certain. Corel WordPerfect can read .wpd files.

The VB files are the ones I used for my Permutations Application, which is incomplete and a bit
sloppy, since I did it in a hurry  for experimental purposes. It has no help files, and only
partially protects itself from user errors and out of memory conditions. My system has 128M
of memory.  I originally intended to use Hard Drive Files for permutations too big for a List Box.
That code was never implemented. A Message Box will tell you if there are too many permutations for the List Box. You can use "One at a time" option to generate some permutations, when the "All at once" option cannot cope.

The "Sort & Verify" option was included primarily to aid in debugging. You might be interested
in the KwikSort & Insert Sort Subroutines. Note that KwikSort is incredibly fast and sorts in
place. The logic could be adapted to sort large disc files of fixed length records, using Insert Sort
to clean up (For disc file sorts, the Insert Sort cleanup is a must to minimize disc accesses).

Included with the VB files are two txt Files containing code from a Main Code Module and the
only Form used.  If the Application does not run, you can probably reconstruct it using the
code from these two files. Studying the code should provide clues to creating the Form.

I (and others) have had problems running VB applications using the Files created on another
system during development, instead of running from "Deployed" files.  This problem could be
due to different versions of VB or some subtle difference in the VB environment when running
on a different system. It could also be due a missing file. I have had problems with my own
applications now and then because VB saved some file in a default directory, due to my not
explicitly specifying the directory where I put everything else for the application. Such a file gets overlooked when attempting to transfer files to another system. 

The Permutations application uses a form with 3 Text Boxes (Corresponding labels), 3 command buttons, and a List box. The Form-Load Procedure sets Captions for Labels & Command buttons.

The "All at once" option uses PermutationMaker Sub to weave the first byte back and forth,
calling Nextmaker when the moving byte is at either end of the string. There is an array of Type
structures containing control data for the process (See Public Type ExchangeData)

The "One at a Time" option also uses NextMaker Sub, but initializes the control array to have
one additional entry.

The basic approach is to move the first byte of a string right & left. For example.

     ABCDEF   BACDEF   BCADEF . . . BCDEFA

When the moving byte is at the right the first time, a similar process is started for the second
byte, after which the first moving byte starts moving to the left. For example, after BCDEFA.

     CBDEFA   CBDEAF   CBDAEF . . . ACBDEF  

When the first moving byte gets to the start of the string, advance the second byte once before
starting the first byte moving to the right. After ACBDEF.

     ACDBEF   CADBEF   CDABEF   CDBAEF . . . CDBEFA

When both the first and second bytes are at extreme positions, the third bytes is moved. After
CDEFBA (A has just been moved and B has previous moved to the right hand limit).

     DCEFBA   DCEBFA   DCEBAF   DCEABF   DCAEBF  . . .

The process is recursive. It is harder to describe than it is to program it. When seen in action (try the "One at a time" Button), it is easy to understand. The first byte moves far more often than any other. If the code has a special case outer loop to control that byte, the program is noticeably faster. The first byte is "remembered," allowing "half exchanges" instead of "full exchanges."